home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / dev / gui / BGUI11c.lha / AmigaE / examples / file.e < prev    next >
Text File  |  1994-12-24  |  5KB  |  116 lines

  1. ;/* Execute me to compile.
  2. ec file
  3. quit
  4. */
  5. /*
  6. **      A small example of BGUI in Amiga E.
  7. **
  8. **      I have little knowledge of the E language so
  9. **      please forgive me if something is wrong or if
  10. **      something could have been done easier.
  11. **
  12. **      GUI stolen from the EasyGUI (file.e) example. Sorry
  13. **      Wouter, I could not resist ;)
  14. **/
  15. OPT OSVERSION=37
  16. OPT PREPROCESS
  17.  
  18. MODULE 'libraries/bgui',
  19.        'libraries/bgui_macros',
  20.        'libraries/gadtools',
  21.        'bgui',
  22.        'tools/boopsi',
  23.        'utility/tagitem',
  24.        'intuition/classes',
  25.        'intuition/classusr',
  26.        'intuition/gadgetclass'
  27.  
  28. /*
  29. **      And were off.
  30. **/
  31. PROC main()
  32.         DEF     wd_obj, running = TRUE, rc = 0, signal, s1, s2, s3
  33.  
  34.         /*
  35.         **      Open the library.
  36.         **/
  37.         IF bguibase := OpenLibrary( 'bgui.library', 37 )
  38.                 /*
  39.                 **      Create a window object.
  40.                 **/
  41.                 wd_obj := WindowObject,
  42.                         WINDOW_TITLE,           'Select a file:',
  43.                         WINDOW_RMBTRAP,         TRUE,
  44.                         WINDOW_AUTOASPECT,      TRUE,
  45.                         WINDOW_SCALEHEIGHT,     20,
  46.                         WINDOW_MASTERGROUP,
  47.                                 /*
  48.                                 **      A vertical master group.
  49.                                 **/
  50.                                 VGroupObject, Spacing( 4 ), HOffset( 4 ), VOffset( 4 ),
  51.                                         StartMember, ListviewObject, EndObject, EndMember,
  52.                                         StartMember, s1 := TabString( 'Pattern', '#?.e', 200, 0 ), FixMinHeight, EndMember,
  53.                                         StartMember, s2 := TabString( 'Drawer',  'E:',   200, 0 ), FixMinHeight, EndMember,
  54.                                         StartMember, s3 := TabString( 'File',    '',     200, 0 ), FixMinHeight, EndMember,
  55.                                         StartMember,
  56.                                                 HGroupObject, Spacing( 4 ),
  57.                                                         StartMember, Button( 'OK', 0 ), EndMember,
  58.                                                         StartMember, Button( 'Disks', 0 ), EndMember,
  59.                                                         StartMember, Button( 'Parent', 0 ), EndMember,
  60.                                                         StartMember, Button( 'Cancel', 0 ), EndMember,
  61.                                                 EndObject, FixMinHeight,
  62.                                         EndMember,
  63.                                 EndObject,
  64.                         EndObject
  65.  
  66.                 /*
  67.                 **      Object created OK?
  68.                 **/
  69.                 IF wd_obj
  70.                         /*
  71.                         **      Setup tab-cycling.
  72.                         **/
  73.                         domethod( wd_obj, [ WM_TABCYCLE_ORDER, s1, s2, s3, NIL ] )
  74.                         /*
  75.                         **      Open up the window.
  76.                         **/
  77.                         IF WindowOpen( wd_obj )
  78.                                 /*
  79.                                 **      Obtain signal mask.
  80.                                 **/
  81.                                 GetAttr( WINDOW_SIGMASK, wd_obj, {signal} )
  82.                                 /*
  83.                                 **      Poll messages.
  84.                                 **/
  85.                                 WHILE running = TRUE
  86.                                         /*
  87.                                         **      Wait for the signal.
  88.                                         **/
  89.                                         Wait( signal )
  90.                                         /*
  91.                                         **      Call uppon the event handler.
  92.                                         **/
  93.                                         WHILE ( rc := HandleEvent( wd_obj )) <> WMHI_NOMORE
  94.                                                 SELECT rc
  95.                                                         CASE    WMHI_CLOSEWINDOW
  96.                                                                 running := FALSE
  97.                                                 ENDSELECT
  98.                                         ENDWHILE
  99.                                 ENDWHILE
  100.                         ENDIF
  101.                         /*
  102.                         **      Disposing of the object
  103.                         **      will automatically close the window
  104.                         **      and dispose of all objects that
  105.                         **      are attached to the window.
  106.                         **/
  107.                         DisposeObject( wd_obj )
  108.                 ELSE
  109.                         WriteF( 'Unable to create a window object\n' )
  110.                 ENDIF
  111.                 CloseLibrary(bguibase)
  112.         ELSE
  113.                 WriteF( 'Unable to open the bgui.library\n' )
  114.         ENDIF
  115. ENDPROC NIL
  116.